package miscellaneous;

public class Equality {
	public static void main(String[] args){
		String x= "JAVA";
		String y = new String("JAVA");
		String z= "JAVA";
		String c = new String();
		c= "JAVA";
		String a = new String("JAVA");
		String b = a;
		if (x ==y ){
			System.out.println("They do match! =");
			
		}
		if (x.equals(y) ){
			System.out.println("They do match! .equals");
			
		}
		if (x == z ){
			System.out.println("They do match! x==z");
			
		}
		if (x == c){
			System.out.println("They do match! x==c");
			
		}
		if (a == y ){
			System.out.println("They do match! a==y");
			
		} 
		if (a == b  ){
			System.out.println("They do match! a==b");
			
		}
		System.out.println("X hashcode:"+x.hashCode());
		System.out.println("Y hashcode:"+y.hashCode());
		System.out.println("X");
		System.out.println("End of test!");
	}
}
